#include <stdio.h>
#include "../../src/gtthread.h"

char g_str[] = "hello world\n";

gtthread_t g_th1, g_th2;

gtthread_mutex_t g_mutex1;

int g_end = 0;

void* worker2(void* arg)
{
	while(1)
	{
		printf("worker2\n");
		g_end++;
	}
}

void* worker(void* arg)
{
	volatile int i=0;
	gtthread_t th;

	gtthread_init(1000);

	gtthread_create(&th, worker2, NULL);


	while(g_end < 5);
	gtthread_cancel(th);
}

int main()
{
	gtthread_t th;

	gtthread_create(&th, worker, NULL);

	gtthread_join(th, NULL);
}
